﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Xml;
using System.IO;


namespace UMLDraw
{
    [XmlRoot("DATA")]
    public class SerilizeData
    {
        public class WPData
        {
            [XmlElement("Name")]
            public string Name;
            [XmlElement("ActualState")]
            public int ActualState;
            [XmlElement("ActualTransfer")]
            public int ActualTransfer;
            [XmlElement("ActualComment")]
            public int ActualComment;
            [XmlElement("WorkPlaceWidht")]
            public int WorkPlaceWidht;
            [XmlElement("WorkPlaceHeight")]
            public int WorkPlaceHeight;

            public WPData()
            {
            }

            public void Save(string name, int AS, int AT, int AC, int X, int Y)
            {
                Name = name;
                ActualState = AS;
                ActualTransfer = AT;
                ActualComment = AC;
                WorkPlaceWidht = X;
                WorkPlaceHeight = Y;
            }
        }
        public class INData
        {
            [XmlElement("XCoor")]
            public int XCoor = 0;
            [XmlElement("YCoor")]
            public int YCoor = 0;
            [XmlElement("isLocated")]
            public bool isLocated = false;
            [XmlArray("OutputName")]
            public List<String> OutputName;

            public INData()
            {
            }

            public void Save(int x, int y, List<String> list, bool key)
            {
                XCoor = x;
                YCoor = y;
                OutputName = list;
                isLocated = key;
            }
        }
        public class OUData
        {
            [XmlElement("XCoor")]
            public int XCoor = 0;
            [XmlElement("YCoor")]
            public int YCoor = 0;
            [XmlElement("isLocated")]
            public bool isLocated = false;
            [XmlArray("InputName")]
            public List<String> InputName;

            public OUData()
            {
            }

            public void Save(int x, int y, List<String> list, bool key)
            {
                XCoor = x;
                YCoor = y;
                isLocated = key;
                InputName = list;
            }
        }
        public class TRData
        {
            [XmlElement("Name")]
            public string Name;
            [XmlElement("Text")]
            public string Text;
            [XmlElement("FromName")]
            public string FromName;
            [XmlElement("ToName")]
            public string ToName;

            public TRData()
            {
            }
            public void Save(string name, string text, string from, string to)
            {
                Name = name;
                Text = text;
                FromName = from;
                ToName = to;
            }
        }
        public class STData
        {
            [XmlElement("Name")]
            public string Name;
            [XmlElement("Text")]
            public string Text;
            [XmlElement("XCoor")]
            public int XCoor;
            [XmlElement("YCoor")]
            public int YCoor;
            [XmlElement("InputName")]
            public List<String> InputName;
            [XmlElement("OutputName")]
            public List<String> OutputName;
            [XmlElement("Entry")]
            public string Entry;
            [XmlElement("Do")]
            public string Do;
            [XmlElement("Exit")]
            public string Exit;
            [XmlElement("Style")]
            public string Style;


            public STData()
            {
            }

            public void Save(string name, string text, int x, int y, List<String> listI, List<String> listO, string en, string d, string ex, string style)
            {
                Name = name;
                Text = text;
                XCoor = x;
                YCoor = y;
                InputName = listI;
                OutputName = listO;
                Entry = en;
                Do = d;
                Exit = ex;
                Style = style;
            }
        }
        public class COData
        {
            [XmlElement("Name")]
            public string Name;
            [XmlElement("Text")]
            public string Text;
            [XmlElement("XCoor")]
            public int XCoor;
            [XmlElement("YCoor")]
            public int YCoor;
            [XmlElement("InputName")]
            public List<String> InputName;
            [XmlElement("OutputName")]
            public List<String> OutputName;

            public COData()
            {
            }

            public void Save(string name, string text, int x, int y, List<String> listI, List<String> listO)
            {
                Name = name;
                Text = text;
                XCoor = x;
                YCoor = y;
                InputName = listI;
                OutputName = listO;
            }
        }

        [XmlElement("WP")]
        public WPData WP = new WPData();
        [XmlElement("IN")]
        public INData IN = new INData();
        [XmlElement("OU")]
        public OUData OU = new OUData();
        [XmlArray("TR")]
        public List<TRData> TR = new List<TRData>();
        [XmlArray("ST")]
        public List<STData> ST = new List<STData>();
        [XmlArray("CO")]
        public List<COData> CO = new List<COData>();
    }
}
